package com.pjhouse.core.user.domain;

import java.util.ArrayList;
import java.util.List;

public enum Role {
	
	ADMINISTRATOR("管理员", "/syserror|/index|/login|/user|/landlord|/customer"),
	MEMBER("雇员","/syserror|/index|/login|/landlord|/customer"),
	DEFAULT("默认","/syserror|/index|/login");
	private final String name;
	private final List<String> uri;
	
	private Role(final String name, final String uriStr){
		this.name = name;
		String[] arr = uriStr.split("|");
		uri = new ArrayList<String>();
		for (String str : arr) {
			uri.add(str);
		}
	}
	
	public static Role get(String name){
		for (Role role : Role.values()) {
			if(role.name.equals(name))
				return role;
		}
		return Role.DEFAULT;
	}
	
	public String getName(){
		return this.name;
	}
	
	public List<String> getUris(){
		return this.uri;
	}
}
